/**
 * Copyright (c) 2009 Teoti Graphix, LLC See:
 *     http://tkarchitecture.teotigraphix.org
 * 
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 * 
 * @author Michael Schmalle mschmalle@teotigraphix.com
 */
package org.teotigraphix.dx.interfaces
{

import flash.events.IEventDispatcher;

/**
 * The <code>IBehaviorManager</code> interface.
 * 
 * @author Michael Schmalle
 * @copyright Teoti Graphix, LLC
 * @date 07-07-09
 */
public interface IBehaviorManager
{
	//--------------------------------------------------------------------------
	//
	//  Methods
	//
	//--------------------------------------------------------------------------
	
	/**
	 * Creates an <code>IBehaviorLayer</code> instance.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @return A new <code>IBehaviorLayer</code> instance.
	 */	
	function createBehaviorLayer(client:IEventDispatcher):IBehaviorLayer;
	
	/**
	 * Returns an <code>IBehaviorLayer</code> instance registered with the 
	 * <code>IEventDispatcher</code> host.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @return The <code>IBehaviorLayer</code> instance.
	 */
	function getBehaviorLayer(client:IEventDispatcher):IBehaviorLayer;
	
	/**
	 * Tests for an <code>IBehaviorLayer</code> instance registered with the 
	 * <code>IEventDispatcher</code> host.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @return A boolean indicating whether the host has a registered 
	 * <code>IBehaviorLayer</code> instance.
	 */	
	function hasBehaviorLayer(client:IEventDispatcher):Boolean;
	
	/**
	 * Registers a <code>IComponentBehavior</code> api.
	 * 
	 * @param api A <code>Class</code> api used as the key for the 
	 * <code>IComponentBehavior</code> behavior instance.
	 * @param clazz A <code>Class</code> api.
	 */
	function registerBehaviorAPI(api:Class, clazz:Class):void;
	
	/**
	 * Creates an <code>IComponentBehavior</code> from a registered 
	 * <code>Class</code> api.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @param api A <code>Class</code> api used as the key for the 
	 * <code>IComponentBehavior</code> behavior instance.
	 * 
	 * @return A new <code>IComponentBehavior</code> instance.
	 */
	function createBehavior(client:IEventDispatcher, api:Class):IComponentBehavior;
	
	/**
	 * Registers an <code>IComponentBehavior</code> to the behavior layer.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @param api A <code>Class</code> api used as the key for the 
	 * <code>IComponentBehavior</code> behavior instance.
	 * @param behavior An <code>IComponentBehavior</code> to register with the 
	 * behavior layer.
	 */
	function registerBehavior(client:IEventDispatcher, api:Class, behavior:IComponentBehavior):void;
	
	/**
	 * Removes an <code>IComponentBehavior</code> from the behavior layer.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @param api A <code>Class</code> api used as the key for the 
	 * <code>IComponentBehavior</code> behavior instance.
	 * @return The removed <code>IComponentBehavior</code>.
	 */
	function removeBehavior(client:IEventDispatcher, api:Class):IComponentBehavior;
	
	/**
	 * Tests for an <code>IComponentBehavior</code> registered with the behavior layer
	 * using a <code>Class</code> api key.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @param api A <code>Class</code> api used as the key for the 
	 * <code>IComponentBehavior</code> behavior instance.
	 * @return A boolean indicating whether the <code>IComponentBehavior</code>
	 * is contained in this layer.
	 */
	function hasBehavior(client:IEventDispatcher, api:Class):Boolean;
	
	/**
	 * Returns an <code>IComponentBehavior</code> registered with the behavior layer
	 * using the registered behavior's <code>Class</code> api key.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @param api A <code>Class</code> api used as the key for the 
	 * <code>IComponentBehavior</code> behavior instance.
	 * @return The <code>IComponentBehavior</code> by <code>Class</code> api.
	 */
	function getBehavior(client:IEventDispatcher, api:Class):IComponentBehavior;
	
	/**
	 * Returns an array of <code>IComponentBehavior</code>'s currently registered
	 * with this layer.
	 * 
	 * @param client The <code>IEventDispatcher</code> host.
	 * @return All <code>IComponentBehavior</code>'s in this layer.
	 */
	function getBehaviors(client:IEventDispatcher):Array;
}
}